<template>
    <div class="demo-avatar">
        <Row>
            <Col span="2">
                <Avatar src="https://i.loli.net/2017/08/21/599a521472424.jpg"/>
            </Col>
            <Col span="10">
                <a v-if="isNeedLogin" href="#" @click="login()">{{msg}}</a>
                <p v-else>{{username}}</p>
            </Col>
        </Row>
    </div>
</template>
<script>
    export default {
        name: 'LoginAvatar',
        methods: {
            login() {
                return this.$router.push({path: '/'})
            }
        },
        data() {
            return {
                msg: '请您登录/注册',
                isNeedLogin: this.$global.isNeedLogin,
                username: this.$global.userName


            }
        }

    }
</script>
